import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class getExcelRow {
    public static void main(String[] args) throws IOException, InvalidFormatException {
        String file_path = "D:\\所有程序\\程存淦\\高新技术企业企查查第一次导出(1)\\";
        File[] dir = new File(file_path).listFiles();
        int count = 0;
        for (File file : dir) {
            FileInputStream in = new FileInputStream(file);
            Workbook workbook = new XSSFWorkbook(in);

            Sheet sheet = workbook.getSheetAt(0);
            count+= sheet.getPhysicalNumberOfRows()-2;
        }
        System.out.println(file_path+"下所有excel条目数："+count);
    }
}
